package com.ape.mapsa.produccion.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the pedido_venta database table.
 * 
 */
@Entity
@Table(name = "pedido_venta")
public class PedidoVenta implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creation_date")
	private Date creationDate;

	// bi-directional many-to-one association to OrdenProduccion
	@OneToMany(mappedBy = "pedidoVenta")
	private List<OrdenProduccion> ordenProduccions;

	// bi-directional many-to-one association to Cliente
	@ManyToOne
	@JoinColumn(name = "cliente")
	private Cliente clienteBean = new Cliente();

	public PedidoVenta() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public List<OrdenProduccion> getOrdenProduccions() {
		return this.ordenProduccions;
	}

	public void setOrdenProduccions(List<OrdenProduccion> ordenProduccions) {
		this.ordenProduccions = ordenProduccions;
	}

	public OrdenProduccion addOrdenProduccion(OrdenProduccion ordenProduccion) {
		getOrdenProduccions().add(ordenProduccion);
		ordenProduccion.setPedidoVenta(this);

		return ordenProduccion;
	}

	public OrdenProduccion removeOrdenProduccion(OrdenProduccion ordenProduccion) {
		getOrdenProduccions().remove(ordenProduccion);
		ordenProduccion.setPedidoVenta(null);

		return ordenProduccion;
	}

	public Cliente getClienteBean() {
		return this.clienteBean;
	}

	public void setClienteBean(Cliente clienteBean) {
		this.clienteBean = clienteBean;
	}

}